import Vapor
import Fluent

final class Employee: Model, Content {

    
    
    static let schema: String = "employee"
    
    @ID
    var id: UUID?
    
    @Field(key: "abbreviation")
    var abbreviation: String
    
    @Field(key: "firstName")
    var firstName: String
    
    @Field(key: "lastName")
    var lastName: String
    
    @Field(key: "jobTitle")
    var jobTitle: String
    
    @Field(key: "jobDescription")
    var jobDescription: String
    
    @Field(key: "email")
    var email: String
    
    @Field(key: "telephoneNumber")
    var telephoneNumber: String
    
    @Field(key: "mobileNumber")
    var mobileNumber: String
    
    @Field(key: "skypeNumber")
    var skypeNumber: String
    
    @Field(key: "isMale")
    var isMale: Bool
    
    @Siblings(through: EmployeeCountryPivot.self, from: \.$employee, to: \.$country)
    var responsibleForCountries: [Country]
    
    @Siblings(through: EmployeeLanguagePivot.self, from: \.$employee, to: \.$language)
    var speaksLanguages: [Language]
    
    @Siblings(through: DepartmentEmployeePivot.self, from: \.$employee, to: \.$department)
    var belongToDepartments: [Department]
 
    init() {
        
    }

    init(id: UUID,
         abbreviation: String,
         firstName: String,
         lastName: String,
         jobTitle: String,
         jobDescription: String,
         email: String,
         telephoneNumber: String,
         mobileNumber: String,
         skypeNumber: String,
         isMale: Bool) {
        self.id = UUID()
        self.abbreviation = abbreviation
        self.firstName = firstName
        self.lastName = lastName
        self.jobTitle = jobTitle
        self.jobDescription = jobDescription
        self.email = email
        self.telephoneNumber = telephoneNumber
        self.mobileNumber = mobileNumber
        self.skypeNumber = skypeNumber
        self.isMale = isMale
    }
    
    
}
